package com.example.androidlearning.sy5;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.view.View;

import com.example.androidlearning.R;

public class PlaneView extends View {
    public  float currentX;
    public float currentY;
    Bitmap plane;
    public PlaneView(Context context){
        super(context);
        plane = BitmapFactory.decodeResource(context.getResources(), R.mipmap.little_plane);
        setFocusable(true);
    }
    public void onDraw(Canvas canvas){
        super.onDraw(canvas);
        //创建画笔
        Paint p = new Paint();
        //绘制飞机
        canvas.drawBitmap(plane,currentX,currentY,p);
    }
}
